from selenium import webdriver


class UtilsDriver:
    _driver = None

    # 定义获取驱动的方法
    @classmethod
    def get_driver(cls):
        if cls._driver is None:
            cls._driver = webdriver.Chrome()
            cls._driver.maximize_window()
            cls._driver.get("http://localhost/")
        return cls._driver

    @classmethod
    def quit_driver(cls):
        if cls._driver is not None:
            cls.get_driver().quit()
            cls._driver = None
